package com.qining618.cms.cms.controller.app;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qining618.cms.cms.domain.ChannelContent;
import com.qining618.cms.cms.service.ChannelContentService;
import com.qining618.common.result.ApiResult;
import com.qining618.common.result.TableData;
import com.qining618.common.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Description;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * CMS栏目内容关联表 前端控制器
 * </p>
 *
 * @author qining
 * @date 2019-09-17
 */
@RestController
@RequestMapping("/app/api/cms/channelContent")
public class AppChannelContentController {

    @Autowired
    private ChannelContentService channelContentService;

    @GetMapping(value = "page")
    @Description("分页")
    public ApiResult page(@RequestParam Map<String, Object> params) {
        Query<ChannelContent> query = new Query<>(params);

        IPage<ChannelContent> pageInfo = channelContentService.page(query.getPage(), query.getQueryWrapper());

        return ApiResult.ok(TableData.of(pageInfo));
    }
}

